#ifndef RENDERARGS_H
#define RENDERARGS_H


#include <stdlib.h>
#include <cuda_runtime.h>
#include "global_object.h"
#include "DeviceObject.cu"
#include "Scene.cu"

using namespace std;
class RenderArgs : public DeviceObject
{
public:
	Vector3	background;
	int2	imageResolution;
	int2	sampleResolution;
    int		maxPasses;
	float3*  imageData;
	float3*	d_imageData;
	//INLINE ALL THE THINGS!!!

	inline __host__ __device__  RenderArgs(void){
		this->size = sizeof(RenderArgs);
	}
	inline __host__ __device__  ~RenderArgs(void);
	inline __host__ __device__  RenderArgs(Vector3 background, int2 imageResolution, int2 sampleResolution, int maxPasses, float3* imageData){
		this->size = sizeof(RenderArgs);
		this->background = background;
		this->imageResolution = imageResolution;
		this->sampleResolution = sampleResolution;
		this->maxPasses = maxPasses;
		this->imageData = imageData;
		d_imageData = NULL;
	}

	inline __host__ void copyToDevice(){
		cudaMalloc(&d_imageData, imageResolution.x*imageResolution.y*sizeof(float3));
		cudaMemcpy(d_imageData, imageData, imageResolution.x*imageResolution.y*sizeof(float3), cudaMemcpyHostToDevice);
		DeviceObject::copyToDevice();
	}

	inline __host__ void updateFromDevice(){
		cudaMemcpy(imageData, d_imageData, imageResolution.x*imageResolution.y*sizeof(float3), cudaMemcpyDeviceToHost);
		DeviceObject::updateFromDevice();
	}

	inline __host__ __device__  static RenderArgs makeQuickRenderArgs(float3* imageData, Scene* scene);
	inline __host__ __device__  static RenderArgs makeHQRenderArgs(float3* imageData, Scene* scene);
};

#endif